<template>
    <div>
      <van-form>
        <van-field
            v-model="fee.dian"
            name="剩余电量"
            label="剩余电量(单位:度/1元)"
            placeholder="剩余电量"
          />
            <van-field
            v-model="fee.xiaoqu"
            name="小区"
            label="小区"
            placeholder="小区"
          />
          <van-field
            v-model="fee.loudong"
            name="楼号"
            label="楼号"
            placeholder="楼号"
          />
          <van-field
            v-model="fee.danyuan"
            name="单元号"
            label="单元号"
            placeholder="单元号"
          />
          <van-field
            v-model="fee.fangjian"
            name="门牌号"
            label="门牌号"
            placeholder="门牌号"
          />
           <van-field
            v-model="fee.username"
            name="业主姓名"
            label="业主姓名"
            placeholder="业主姓名"
          />
          <van-field
            v-model="fee.money"
            name="缴费金额"
            label="缴费金额"
            placeholder="请输入缴费金额"
          />

          <div style="margin: 16px;">
            <van-button round block type="info" native-type="submit" @click="dian">提交</van-button>
          </div> 
      </van-form>
      
    </div>
</template>
<script>
export default {
  data() {
    return {
        fee:{
        hid:'',
        xiaoqu:'',
       loudong:'',
       danyuan:'',
       fangjian:'',
       shenfen:'',
       uid:'',
        water:'',
        dian:'',
        car:'',
       username:'',
       money:''
  
       }
    };
  },
  methods: {
    dian() {
       //alert("khskhlkskjs")
            this.$axios.post("addOrder",this.fee).then(res=>{
              if(res.data.code==1){
                alert(res.data.info);
                this.$axios.post("fee/updateDianMoney",this.fee).then(resp=>{
                    if(res.data.code==1){
                      alert(resp.data.info);
                      this.$router.push("/pay")
                    }
                 })
              }
            })
    }

  },
  created(){
      this.$axios.get("fee/findById").then(res=>{
        if(res.data.code==1){
          this.fee=res.data.data;
           
        }
      })
  }

};
</script>